var n = require("../../services/api.js");

Page({
    data: {
        info: {},
        checkId: ""
    },
    onLoad: function(n) {
        n.id ? this.getInfo(n.id) : wx.showModal({
            title: "提示",
            content: "无效的团购券",
            showCancel: !1,
            success: function() {
                wx.navigateBack();
            }
        });
    },
    getInfo: function(t) {
        var a = this;
        (0, n.getScanDetail)({
            id: t
        }).then(function(n) {
            200 === n.data.code ? a.setData({
                info: n.data.data,
                checkId: t
            }) : wx.showModal({
                title: "提示",
                content: n.data.message,
                showCancel: !1,
                success: function() {
                    wx.navigateBack();
                }
            });
        });
    },
    send: function() {
        var t = this.data.checkId;
        (0, n.checkOrder)({
            id: t
        }).then(function(n) {
            200 === n.data.code ? (wx.showToast({
                title: "核销成功",
                mask: !0,
                duration: 1500
            }), setTimeout(function() {
                wx.navigateBack();
            }, 1500)) : wx.showModal({
                title: "提示",
                content: n.data.message,
                showCancel: !1
            });
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});